package kernel.db.basics;


import java.sql.SQLException;
import java.sql.ResultSet;

public class Necessitepiece extends DBOperator{

	/* ############################### Fields ############################### */
	private int IdTypeInscription;

	private Piece IdPiece;

	/* ############################### Getters ############################## */
	public int getIdTypeInscription(){
		return IdTypeInscription;
	}

	public Piece getIdPiece(){
		return IdPiece;
	}

	/* ############################### Setters ############################## */
	public void setIdTypeInscription(int newValue){
		this.IdTypeInscription = newValue;
	}

	public void setIdPiece(Piece newValue){
		this.IdPiece = newValue;
	}

	/* ########################### CLASS CONSTRUCTORS ####################### */
	public Necessitepiece(int IdPiece) throws SQLException {
		this.IdPiece = IdPiece;
		this.IdTypeInscription = executeUpdate("INSERT INTO necessitepiece VALUES('DEFAULT','"+IdPiece+"')");
	}

	public Necessitepiece(int IdTypeInscription, int IdPiece) throws SQLException {
		ResultSet rs = executeSelect("SELECT * FROM necessitepiece WHERE IdTypeInscription='"+IdTypeInscription+"' AND IdPiece='"+IdPiece+"'");
				this.IdTypeInscription = rs.getInt(IdTypeInscription);
		this.IdPiece = rs.getInt(IdPiece);

	}
}